	.file	"cyclebuf.c"
	.section	.rodata
.LC0:
	.string	"cyclebuf malloc failed"
	.text
.globl init_cyclebuf
	.type	init_cyclebuf, @function
init_cyclebuf:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$4, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	8(%ebp), %eax
	movl	$100, 4(%eax)
	movl	8(%ebp), %eax
	movl	4(%eax), %eax
	movl	%eax, (%esp)
	call	malloc@PLT
	movl	%eax, %edx
	movl	8(%ebp), %eax
	movl	%edx, (%eax)
	movl	8(%ebp), %eax
	movl	(%eax), %eax
	testl	%eax, %eax
	jne	.L2
	leal	.LC0@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	puts@PLT
.L2:
	movl	8(%ebp), %eax
	movl	$0, 12(%eax)
	movl	8(%ebp), %eax
	movl	12(%eax), %edx
	movl	8(%ebp), %eax
	movl	%edx, 8(%eax)
	movl	8(%ebp), %eax
	movb	$0, 16(%eax)
	addl	$4, %esp
	popl	%ebx
	popl	%ebp
	ret
	.size	init_cyclebuf, .-init_cyclebuf
	.section	.rodata
.LC1:
	.string	"cycle empty"
	.text
.globl is_empty
	.type	is_empty, @function
is_empty:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$20, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	8(%ebp), %eax
	movzbl	16(%eax), %eax
	testb	%al, %al
	jne	.L6
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	cmpl	%eax, %edx
	jne	.L6
	leal	.LC1@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	puts@PLT
	movl	$1, -8(%ebp)
	jmp	.L9
.L6:
	movl	$0, -8(%ebp)
.L9:
	movl	-8(%ebp), %eax
	addl	$20, %esp
	popl	%ebx
	popl	%ebp
	ret
	.size	is_empty, .-is_empty
	.section	.rodata
.LC2:
	.string	"cycle full"
	.text
.globl is_full
	.type	is_full, @function
is_full:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%esi
	pushl	%ebx
	subl	$16, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	8(%ebp), %eax
	movzbl	16(%eax), %eax
	cmpb	$1, %al
	jne	.L12
	movl	8(%ebp), %eax
	movl	8(%eax), %esi
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	1(%eax), %ecx
	movl	$1374389535, -20(%ebp)
	movl	-20(%ebp), %eax
	mull	%ecx
	movl	%edx, %eax
	shrl	$5, %eax
	movl	%eax, -16(%ebp)
	imull	$100, -16(%ebp), %eax
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, -16(%ebp)
	cmpl	-16(%ebp), %esi
	jne	.L12
	leal	.LC2@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	puts@PLT
	movl	$1, -12(%ebp)
	jmp	.L15
.L12:
	movl	$0, -12(%ebp)
.L15:
	movl	-12(%ebp), %eax
	addl	$16, %esp
	popl	%ebx
	popl	%esi
	popl	%ebp
	ret
	.size	is_full, .-is_full
	.section	.rodata
.LC3:
	.string	"[R] ring buf {%s}, %d, %d\n"
.LC4:
	.string	"[R] <<< {%s}, %d, %d\n"
	.align 4
.LC5:
	.string	"[R] <<<  {%s}, ridx %d, rest %d\n"
	.align 4
.LC6:
	.string	"[R] <<< {%s}, ridx %d,  len %d\n"
	.text
.globl r_buf
	.type	r_buf, @function
r_buf:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%edi
	pushl	%esi
	pushl	%ebx
	subl	$44, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	$0, -20(%ebp)
	movl	$0, -16(%ebp)
	movl	8(%ebp), %eax
	movl	%eax, (%esp)
	call	is_empty@PLT
	testb	%al, %al
	je	.L18
	movl	$0, -32(%ebp)
	jmp	.L20
.L18:
	movl	8(%ebp), %eax
	movl	12(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	cmpl	%eax, %edx
	jbe	.L21
	movl	8(%ebp), %eax
	movl	12(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	movl	%eax, -20(%ebp)
	jmp	.L23
.L21:
	movl	8(%ebp), %eax
	movl	4(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	subl	%eax, %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	%eax, -20(%ebp)
.L23:
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	cmpl	%eax, %edx
	jae	.L24
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	addl	%eax, %edx
	movl	12(%ebp), %eax
	movl	-20(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	-20(%ebp), %eax
	movl	%eax, 12(%esp)
	movl	%edx, 8(%esp)
	movl	12(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	.LC3@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	movl	%eax, %edx
	addl	-20(%ebp), %edx
	movl	8(%ebp), %eax
	movl	%edx, 8(%eax)
	jmp	.L26
.L24:
	movl	8(%ebp), %eax
	movl	4(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	cmpl	-20(%ebp), %eax
	jbe	.L27
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	addl	%eax, %edx
	movl	12(%ebp), %eax
	movl	-20(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	-20(%ebp), %eax
	movl	%eax, 12(%esp)
	movl	%edx, 8(%esp)
	movl	12(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	.LC4@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	movl	%eax, %edx
	addl	-20(%ebp), %edx
	movl	8(%ebp), %eax
	movl	%edx, 8(%eax)
	jmp	.L26
.L27:
	movl	12(%ebp), %eax
	movl	-20(%ebp), %edx
	movl	%eax, %edi
	cld
	movl	%edx, %ecx
	movl	$0, %eax
	rep
	stosb
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	addl	%eax, %edx
	movl	12(%ebp), %eax
	movl	-16(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	-16(%ebp), %eax
	movl	%eax, 12(%esp)
	movl	%edx, 8(%esp)
	movl	12(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	.LC5@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	-16(%ebp), %edx
	movl	-20(%ebp), %eax
	movl	%eax, %ecx
	subl	%edx, %ecx
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	-16(%ebp), %eax
	addl	12(%ebp), %eax
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	movl	%eax, %edx
	addl	-20(%ebp), %edx
	movl	8(%ebp), %eax
	movl	4(%eax), %eax
	movl	%eax, -36(%ebp)
	movl	%edx, %eax
	movl	$0, %edx
	divl	-36(%ebp)
	movl	8(%ebp), %eax
	movl	%edx, 8(%eax)
	movl	-16(%ebp), %edx
	movl	-20(%ebp), %eax
	movl	%eax, %ecx
	subl	%edx, %ecx
	movl	%ecx, %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %ecx
	movl	-16(%ebp), %eax
	addl	12(%ebp), %eax
	movl	%edx, 12(%esp)
	movl	%ecx, 8(%esp)
	movl	%eax, 4(%esp)
	leal	.LC6@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	8(%ebp), %eax
	movb	$0, 16(%eax)
.L26:
	movl	-20(%ebp), %eax
	movl	%eax, -32(%ebp)
.L20:
	movl	-32(%ebp), %eax
	addl	$44, %esp
	popl	%ebx
	popl	%esi
	popl	%edi
	popl	%ebp
	ret
	.size	r_buf, .-r_buf
	.section	.rodata
.LC7:
	.string	"[W] ring buf [%s], widx %d\n"
.LC8:
	.string	"[W] >>>[%s], widx %d\n"
.LC9:
	.string	"[W] >>> [%s], widx %d\n"
.LC10:
	.string	"buffer can't write %d, %d\n"
	.text
.globl w_buf
	.type	w_buf, @function
w_buf:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%edi
	pushl	%esi
	pushl	%ebx
	subl	$44, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	$0, -16(%ebp)
	movl	8(%ebp), %eax
	movl	%eax, (%esp)
	call	is_full@PLT
	testb	%al, %al
	je	.L31
	movl	$1, -32(%ebp)
	jmp	.L33
.L31:
	movl	8(%ebp), %eax
	movl	12(%eax), %edx
	movl	8(%ebp), %eax
	movl	8(%eax), %eax
	cmpl	%eax, %edx
	jb	.L34
	movl	8(%ebp), %eax
	movl	4(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	cmpl	16(%ebp), %eax
	jbe	.L36
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	12(%ebp), %edx
	movl	16(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	12(%eax), %ecx
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	%ecx, 8(%esp)
	movl	%eax, 4(%esp)
	leal	.LC7@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	movl	%eax, %edx
	addl	16(%ebp), %edx
	movl	8(%ebp), %eax
	movl	%edx, 12(%eax)
	jmp	.L39
.L36:
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	12(%ebp), %edx
	movl	-16(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	12(%eax), %ecx
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	%ecx, 8(%esp)
	movl	%eax, 4(%esp)
	leal	.LC8@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	-16(%ebp), %edx
	movl	16(%ebp), %eax
	movl	%eax, %ecx
	subl	%edx, %ecx
	movl	-16(%ebp), %eax
	movl	%eax, %edx
	addl	12(%ebp), %edx
	movl	8(%ebp), %eax
	movl	(%eax), %eax
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	movl	%eax, %edx
	addl	16(%ebp), %edx
	movl	8(%ebp), %eax
	movl	4(%eax), %eax
	movl	%eax, -36(%ebp)
	movl	%edx, %eax
	movl	$0, %edx
	divl	-36(%ebp)
	movl	8(%ebp), %eax
	movl	%edx, 12(%eax)
	movl	8(%ebp), %eax
	movl	12(%eax), %edx
	movl	8(%ebp), %eax
	movl	(%eax), %eax
	movl	%edx, 8(%esp)
	movl	%eax, 4(%esp)
	leal	.LC9@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	8(%ebp), %eax
	movb	$1, 16(%eax)
	jmp	.L39
.L34:
	movl	8(%ebp), %eax
	movl	8(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	cmpl	16(%ebp), %eax
	jbe	.L40
	movl	8(%ebp), %eax
	movl	(%eax), %edx
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	leal	(%edx,%eax), %eax
	movl	12(%ebp), %edx
	movl	16(%ebp), %ecx
	movl	%eax, %edi
	movl	%edx, %esi
	cld
	rep
	movsb
	movl	8(%ebp), %eax
	movl	12(%eax), %eax
	movl	%eax, %edx
	addl	16(%ebp), %edx
	movl	8(%ebp), %eax
	movl	%edx, 12(%eax)
	jmp	.L39
.L40:
	movl	$380, 8(%esp)
	movl	-16(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	.LC10@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
.L39:
	movl	$0, -32(%ebp)
.L33:
	movl	-32(%ebp), %eax
	addl	$44, %esp
	popl	%ebx
	popl	%esi
	popl	%edi
	popl	%ebp
	ret
	.size	w_buf, .-w_buf
	.section	.rodata
.LC11:
	.string	"before ridx %d\n"
.LC12:
	.string	"atfer ridx %d, <%s>, len:%d\n"
	.text
.globl read_cyclebuf
	.type	read_cyclebuf, @function
read_cyclebuf:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%edi
	pushl	%ebx
	subl	$80, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	leal	-62(%ebp), %edi
	cld
	movl	$50, %ecx
	movl	$0, %eax
	rep
	stosb
	movl	$0, -12(%ebp)
.L44:
	leal	-62(%ebp), %eax
	movl	%eax, %edi
	cld
	movl	$50, %ecx
	movl	$0, %eax
	rep
	stosb
	movl	ring_buf@GOT(%ebx), %eax
	movl	8(%eax), %eax
	movl	%eax, 4(%esp)
	leal	.LC11@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	leal	-62(%ebp), %eax
	movl	%eax, 4(%esp)
	movl	ring_buf@GOT(%ebx), %eax
	movl	%eax, (%esp)
	call	r_buf@PLT
	movl	%eax, -12(%ebp)
	movl	ring_buf@GOT(%ebx), %eax
	movl	8(%eax), %edx
	movl	-12(%ebp), %eax
	movl	%eax, 12(%esp)
	leal	-62(%ebp), %eax
	movl	%eax, 8(%esp)
	movl	%edx, 4(%esp)
	leal	.LC12@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	$100, (%esp)
	call	usleep@PLT
	jmp	.L44
	.size	read_cyclebuf, .-read_cyclebuf
	.section	.rodata
.LC14:
	.string	"before widx  %d\n"
.LC15:
	.string	"atfer widx %d\n"
	.align 4
.LC13:
	.string	"hello world welcome to china source insight"
	.text
.globl write_cyclebuf
	.type	write_cyclebuf, @function
write_cyclebuf:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$68, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	movl	.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -48(%ebp)
	movl	4+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -44(%ebp)
	movl	8+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -40(%ebp)
	movl	12+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -36(%ebp)
	movl	16+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -32(%ebp)
	movl	20+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -28(%ebp)
	movl	24+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -24(%ebp)
	movl	28+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -20(%ebp)
	movl	32+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -16(%ebp)
	movl	36+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -12(%ebp)
	movl	40+.LC13@GOTOFF(%ebx), %eax
	movl	%eax, -8(%ebp)
	movb	$1, -52(%ebp)
	movb	$2, -51(%ebp)
	movb	$3, -50(%ebp)
	movb	$4, -49(%ebp)
.L47:
	movl	ring_buf@GOT(%ebx), %eax
	movl	12(%eax), %eax
	movl	%eax, 4(%esp)
	leal	.LC14@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	$44, 8(%esp)
	leal	-48(%ebp), %eax
	movl	%eax, 4(%esp)
	movl	ring_buf@GOT(%ebx), %eax
	movl	%eax, (%esp)
	call	w_buf@PLT
	movl	ring_buf@GOT(%ebx), %eax
	movl	12(%eax), %eax
	movl	%eax, 4(%esp)
	leal	.LC15@GOTOFF(%ebx), %eax
	movl	%eax, (%esp)
	call	printf@PLT
	movl	$100, (%esp)
	call	usleep@PLT
	jmp	.L47
	.size	write_cyclebuf, .-write_cyclebuf
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	pushl	%ecx
	subl	$80, %esp
	call	__i686.get_pc_thunk.bx
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	leal	-64(%ebp), %eax
	movl	%eax, (%esp)
	call	pthread_attr_init@PLT
	movl	$0, 4(%esp)
	leal	-64(%ebp), %eax
	movl	%eax, (%esp)
	call	pthread_attr_setdetachstate@PLT
	movl	ring_buf@GOT(%ebx), %eax
	movl	%eax, (%esp)
	call	init_cyclebuf@PLT
	movl	write_cyclebuf@GOT(%ebx), %eax
	movl	$0, 12(%esp)
	movl	%eax, 8(%esp)
	leal	-64(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	-72(%ebp), %eax
	movl	%eax, (%esp)
	call	pthread_create@PLT
	movl	read_cyclebuf@GOT(%ebx), %eax
	movl	$0, 12(%esp)
	movl	%eax, 8(%esp)
	leal	-64(%ebp), %eax
	movl	%eax, 4(%esp)
	leal	-68(%ebp), %eax
	movl	%eax, (%esp)
	call	pthread_create@PLT
	movl	-72(%ebp), %eax
	movl	$0, 4(%esp)
	movl	%eax, (%esp)
	call	pthread_join@PLT
	movl	-68(%ebp), %eax
	movl	$0, 4(%esp)
	movl	%eax, (%esp)
	call	pthread_join@PLT
	leal	-64(%ebp), %eax
	movl	%eax, (%esp)
	call	pthread_attr_destroy@PLT
	movl	$0, %eax
	addl	$80, %esp
	popl	%ecx
	popl	%ebx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.comm	ring_buf,20,4
	.ident	"GCC: (GNU) 4.1.2 20070925 (Red Hat 4.1.2-33)"
	.section	.text.__i686.get_pc_thunk.bx,"axG",@progbits,__i686.get_pc_thunk.bx,comdat
.globl __i686.get_pc_thunk.bx
	.hidden	__i686.get_pc_thunk.bx
	.type	__i686.get_pc_thunk.bx, @function
__i686.get_pc_thunk.bx:
	movl	(%esp), %ebx
	ret
	.section	.note.GNU-stack,"",@progbits
